package com.itheima.mapper;

import com.itheima.entity.User;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface UserMapper {

    /**
     * 查询所有用户
     *
     * @return
     */
    @Select("select * from tb_user")
    List<User> selectUserList();

    /**
     * 根据用户ID查询
     *
     * @param id
     * @return
     */
    @Select("select * from tb_user where id=#{id}")
    User selectOneUser(Long id);

    /**
     * 根据用户名查询
     *
     * @param userName
     * @return
     */
    @Select("select * from tb_user where username=#{userName}")
    User selectOneUserByName(String userName);
}
